<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
		  xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout">
<html>
<head>
<meta charset="UTF-8"/>
<link th:href="@{/base/easyui/easyui.css}" rel="stylesheet" type="text/css">
<link th:href="@{/base/easyui/easyui_animation.css}" rel="stylesheet" type="text/css">
<link th:href="@{/base/easyui/easyui_plus.css}" rel="stylesheet" type="text/css">
<link id="easyuiTheme" th:href="@{/base/easyui/insdep_theme_default.css}" rel="stylesheet" type="text/css">
<link th:href="@{/base/easyui/icon.css}" rel="stylesheet}" type="text/css">

<link th:href="@{/base/layui/css/layui.css}" rel="stylesheet" media="all"/>
<link th:href="@{/base/font-awesome/css/font-awesome.min.css}" rel="stylesheet"  media="all"/>

<script type="text/javascript" th:src="@{/base/js/jquery.min.js}"></script>
<script type="text/javascript" th:src="@{/base/js/jquery.easyui.min.js}"></script>
<script type="text/javascript" th:src="@{/base/easyui/jquery.insdep-extend.min.js}"></script>

<script type="text/javascript" th:src="@{/base/js/common.js}"></script>
<script type="text/javascript" th:src="@{/base/js/talkDialog.js}"></script>
<script type="text/javascript" th:src="@{/base/js/grid.js}"></script>
<script type="text/javascript" th:src="@{/base/easyui/easyui-extensions/jeasyui.extensions.ty.js}"></script>
<script th:src="@{/base/layer/2.4/layer.js}"></script>
<script th:src="@{/base/js/jquery.cookie.js}"></script>
<script th:src="@{/base/js/connect.js}"></script>
<script th:src="@{/base/js/container.js}"></script>
<style type="text/css">
	.online{
		border-radius: 50%;
		width: 8px;height: 8px;
		background-color: #2B9E0A;
		margin-left: 4px;
	}
	.unline{
		border-radius: 50%;
		width: 8px;height: 8px;
		background-color: #DB2828;
		margin-left: 4px;
	}
</style>
</head>

<body>
	<div id="master-layout">
        <div data-options="region:'north',border:false,bodyCls:'theme-header-layout'">
        	<div class="theme-navigate">
                <div class="left">
                    <a href="#" class="easyui-linkbutton left-control-switch"><i class="fa fa-bars fa-lg"></i></a>
                    <a href="#" class="easyui-menubutton theme-navigate-user-button" data-options="menu:'#theme-navigate-user-panel-me'"  th:text="${session.userInfo.realname }"></a>
                    <a href="#" id="unread"  class="easyui-menubutton" data-options="menu:'#mm3',hasDownArrow:false">在线人数<span id="online_count" class="badge color-important">0</span></a>
                    <div id="mm3" class="theme-navigate-menu-panel">
<!--                         <div>Arain<span class="badge color-success"></span></div> -->
<!--                         <div>Amber<span class="badge color-important"></span></div> -->
                    </div>
                    
                    <div class="theme-navigate-user-panel" id="theme-navigate-user-panel-me">
                       <dl>
                       		<dd th:switch="${session.userInfo.expired}">
                            	<img  onclick="upload_head()" th:src="${user_head }" width="86" height="86">
                            	<!-- <i class="badge color-important">10</i> -->
                                <b class="badge-prompt"><a th:text="${session.userInfo.realname }"></a></b>
                                <span th:text="${session.userInfo.email }"></span>
                                <p th:case="2">密码强度：<i class=" text-success" th:text="${user_rank}"></i></p>
	                             <p th:case="1">密码强度：<i class="text-info" th:text="${user_rank}"></i></p>
	                            <p th:case="0">密码强度：<i class="text-warning" th:text="${user_rank}"></i></p>
                            </dd>
                            <dt>
                            	<a class="theme-navigate-user-modify">修改资料</a>
                                <a class="theme-navigate-user-logout" id="logout">注销</a>
                            </dt>
                       </dl>
                    </div>
                    
                </div>
                <div class="right">
                    <select id="cc2" class="easyui-combobox theme-navigate-combobox" name="dept" style="width:180px;" data-options="valueField:'id',textField:'text',url:'/system/common/load_css.do',onClick: function(rec){changeTheme(rec.id)}">  
<!--                     	<option onclick="changeTheme(insdep_theme_default.css)">星空黑</option>    -->
<!--                     	<option onclick="changeTheme(insdep_theme_blue.css)">水晶蓝</option>  -->
                    </select>  
                    <input class="easyui-searchbox theme-navigate-search" data-options="prompt:'搜索用户名..',menu:'#mm',searcher:doSearch" style="width:300px"></input>
                    <div id="mm" class="theme-navigate-menu-panel">
                        <div data-options="name:'all'">全部好友</div>
                    </div>
                </div>
            </div>
        </div>
        <!--开始左侧菜单-->
        <div data-options="region:'west',border:false,bodyCls:'theme-left-layout'" style="width:200px;">
            <!--正常菜单--> 
            <div class="theme-left-normal">
                <!--theme-left-switch 如果不需要缩进按钮，删除该对象即可-->    
                <div class="left-control-switch theme-left-switch"><i class="fa fa-chevron-left fa-lg"></i></div>
                <!--start class="easyui-layout"-->
                <div class="easyui-layout" data-options="border:false,fit:true"> 
                    <!--start region:'north'-->
                    <div data-options="region:'north',border:false" style="height:100px;">
                        <!--start theme-left-user-panel-->
                        <div class="theme-left-user-panel">
                            <dl>
                                <dt>
                                    <img onclick="upload_head()" th:src="${user_head }" width="43" height="43">
                                </dt>
                                <dd th:switch="${session.userInfo.expired}">
                                <input type="hidden" value="0" id="line_state">
                                     <b class="badge-prompt"><a th:text="${session.userInfo.realname }"></a>
                                     <button id="online" onclick="online()" class="unline">
                                     </button></b>
<!--                                       <span th:text="${session.userInfo.email }"></span> -->
	                                <p th:case="2">密码强度：<i class=" text-success" th:text="${user_rank}"></i></p>
	                             <p th:case="1">密码强度：<i class="text-info" th:text="${user_rank}"></i></p>
	                            <p th:case="0">密码强度：<i class="text-warning" th:text="${user_rank}"></i></p>
                            </dd>
                                </dd>
                            </dl>
                        </div>
                        <!--end theme-left-user-panel-->
                    </div>   
                    <!--end region:'north'-->
                    <!--start region:'center'-->
                    <div data-options="region:'center',border:false">
                        <!--start easyui-accordion--> 
	                        <div class="easyui-accordion" id="menus" data-options="border:true,fit:true" >
									<div th:title="${resource.name }" th:id="${resource.id }"  th:attr="data-options='iconCls:\''+${resource.icon}+'\''" th:each="resource,resourceStat : ${container }">   
											<ul class="easyui-datalist"  th:attr="data-options='border:false,fit:true,pidFiled:\'pid\',urlFiled:\'url\',iconClsFiled:\'iconCls\',textFiled:\'text\',valueField:\'id\',lines:false,url:\'/ajaxLoadUserChildrenResource.do?pid='+${resource.id}+'\',onClickRow:function(index,value){menusTreeOnClick(index,value)}'"></ul>
	                            	</div>   
                        	</div>
                        <!--end easyui-accordion--> 
                    </div>
                    <!--end region:'center'-->
                </div>  
                <!--end class="easyui-layout"-->
            </div>
            <!--最小化菜单--> 
            <div class="theme-left-minimal">
                <ul class="easyui-datalist" style="width:100px;" data-options="border:false,fit:true,urlFiled:'url',iconClsFiled:'iconCls',textFiled:'text',valueField:'id',lines:false,url:'/system/quick/load_01.do',onClickRow:function(index,value){quickTreeOnClick(index,value)}" id="quickMenu">
                </ul>
            </div>
        </div>
        <!--结束左侧菜单--> 
        <div id="tabs" class="easyui-tabs theme-tab-blue-line" data-options="region:'center',border:false,fit:true" style="width:100%;height:920px;background:#fff;overflow:hidden;">
		        <div title="首页" data-options="iconCls:'fa fa-home'">
							<iframe src="/system/main" width="90%" height="100%" scrolling="no"  frameborder="0"  id="index_welcome"></iframe>
						</div>
        </div>
<!--         <div data-options="region:'center',border:false,href:'/system/default'"  id="control" style="padding:20px; background:#fff;"> -->
        </div>
    </div>

		<span style="font-family:KaiTi_GB2312;font-size:18px;">  <!-- 这里是tabs页面的右键 -->  
			  <div id="rcmenu" class="easyui-menu" style="">  
			    <div id="closeall">关闭全部</div>  
			    <div id="closeother">关闭其他</div>
			    <div id="quickmenu">加入快捷菜单</div>
			    <div id="deletemenu">删除此快捷菜单</div>
			  </div>
			  </span> 
			  
	<div id="loading" style="position:absolute;z-index:1000;top:0px;left:0px;width:100%;height:100%;background:#1D1D1D;text-align :center;padding-top:20%;"  
     	<h1><font color="#FFFFFF">加载中,请稍等片刻....</font></h1>  
     </div> 
     
<script src="http://cdn.sockjs.org/sockjs-0.3.min.js"></script>  
<script>
			var left_control_status=true;
			function closes() {  
			    $('#loading').fadeOut('normal', function () {  
			        $(this).remove();  
			    });  
			}  
			var pc;  
			  
			$.parser.onComplete = function () {  
			    if (pc) clearTimeout(pc);  
			    pc = setTimeout(closes, 1000);  
			} 
	/*退出系统*/
	$("#logout").on('click', function() {
		$.messager.confirm('提示', '确定退出系统？', function(r) {
			if(r) {
				document.location.href = "/system/logout";
			}
		});
	});
    	$(function(){
			/*布局部分*/
			$('#master-layout').layout({
				fit:true/*布局框架全屏*/
			});   

            /*右侧菜单控制部分*/
            var left_control_panel=$("#master-layout").layout("panel",'west');

            $(".left-control-switch").on("click",function(){
                if(left_control_status){
                    left_control_panel.panel('resize',{width:70});
                    left_control_status=false;
                    $(".theme-left-normal").hide();
                    $(".theme-left-minimal").show();
                    
                    var west=$("#master-layout").layout("panel",'west');
        			var witdh = $(window).width()-west.width();
        			$("#index_welcome").css("width",witdh+"px")
        			$('iframe[name="iframepage"]').css("width",witdh+"px")
                }else{
                    left_control_panel.panel('resize',{width:200});
                    left_control_status=true;
                    $(".theme-left-normal").show();
                    $(".theme-left-minimal").hide();
                    
                    var west=$("#master-layout").layout("panel",'west');
        			var witdh = $(window).width()-west.width();
        			$("#index_welcome").css("width",witdh+"px")
        			$('iframe[name="iframepage"]').css("width",witdh+"px")
                }
                $("#master-layout").layout('resize', {width:'100%'})
            });

            /*右侧菜单控制结束*/
			$(".theme-navigate-user-modify").on("click",function(){
                $('.theme-navigate-user-panel').menu('hide');
// 				$.insdep.window({id:"personal-set-window",href:"/system/user/edit_myself",title:"修改资料"});
				opendialog({title:'修改资料',width:'50%',height:'70%',url:'/system/user/edit_myself'})
               
            }); 
			var cc2=$('#cc2').combo('panel');
			cc2.panel({cls:"theme-navigate-combobox-panel"});
			
			$(".easyui-tabs").bind('contextmenu',function(e){         
		        e.preventDefault();  
		           $('#rcmenu').menu('show', {  
		               left: e.pageX,  
		               top: e.pageY  
		           });  
		       });  
		         
		       //关闭所有标签页  
		       $("#closeall").bind("click",function(){  
		           var tablist = $('#tabs').tabs('tabs');  
		           for(var i=tablist.length-1;i>=1;i--){  
		               $('#tabs').tabs('close',i);  
		           }  
		       });  
		       //关闭其他页面（先关闭右侧，再关闭左侧）  
		       $("#closeother").bind("click",function(){  
		           var tablist = $('#tabs').tabs('tabs');  
		           var tab = $('#tabs').tabs('getSelected');  
		           var index = $('#tabs').tabs('getTabIndex',tab);  
		           for(var i=tablist.length-1;i>index;i--){  
		               $('#tabs').tabs('close',i);  
		           }  
		           var num = index-1;  
		           if(num < 1){  
		               return;  
		           }else{  
		               for(var i=num;i>=1;i--){  
		                   $('#tabs').tabs('close',i);  
		               }  
		               $("#tabs").tabs("select", 1);  
		           }  
		       });  
		       
		       $("#quickmenu").bind("click",function(){
		    	   var tablist = $('#tabs').tabs('tabs');  
		           var tab = $('#tabs').tabs('getSelected');  
		           var id = tab.panel('options').id;
		           jQuery.ajax({ 
		    			type: "post",
		    			url: "/system/quick/save.do",
		    			data:{resourceId:id},
		    			dataType: "json",
		    			success: function(data){
		    				if(data.status==200) {
		    					layer.msg("保存成功",{icon:1,time:3000});
		    					$("#quickMenu").datalist('reload');

		    				} else {
		    					layer.msg(data.msg,{icon:5,time:3000});
		    				}
		    			}
		       		})
		       });
		       
		       $("#deletemenu").bind("click",function(){
		    	   var tablist = $('#tabs').tabs('tabs');  
		           var tab = $('#tabs').tabs('getSelected');  
		           var id = tab.panel('options').id;
		           jQuery.ajax({ 
		    			type: "post",
		    			url: "/system/quick/delete.do",
		    			data:{resourceId:id},
		    			dataType: "json",
		    			success: function(data){
		    				if(data.status==200) {
		    					layer.msg("删除成功",{icon:1,time:3000});
		    					$("#quickMenu").datalist('reload');

		    				} else {
		    					layer.msg(data.msg,{icon:5,time:3000});
		    				}
		    			}
		       		})
		       });
		       
		});
		function doSearch(value,name){
			var state = $("#line_state").val();
				if(state==0) {
					layer.msg('请先上线！',{icon:5,time:3000});
					return;
				}
				searchUser(value);
			}
			
		function menusTreeOnClick(index,row) {
			addTab(row.text,row.url,row.id,row.iconCls);
		}
		function quickTreeOnClick(index,row) {
			if(row.id==-100) {
		            var left_control_panel=$("#master-layout").layout("panel",'west');
		             if(left_control_status){
		                  left_control_panel.panel('resize',{width:70});
		                  left_control_status=false;
		                  $(".theme-left-normal").hide();
		                  $(".theme-left-minimal").show();
		                  
		                  var west=$("#master-layout").layout("panel",'west');
		        		  var witdh = $(window).width()-west.width();
		        		  $("#index_welcome").css("width",witdh+"px")
		        		  $('iframe[name="iframepage"]').css("width",witdh+"px")
		              }else{
		                  left_control_panel.panel('resize',{width:200});
		                  left_control_status=true;
		                  $(".theme-left-normal").show();
		                  $(".theme-left-minimal").hide();
		                  
		                  var west=$("#master-layout").layout("panel",'west');
		        		  var witdh = $(window).width()-west.width();
		        		  $("#index_welcome").css("width",witdh+"px")
		        		  $('iframe[name="iframepage"]').css("width",witdh+"px")
		              }
		              $("#master-layout").layout('resize', {width:'100%'})
			} else {
				addTab(row.text.substring(row.text.indexOf("<p>")+3,row.text.length-4),row.url,row.id,row.iconCls);
			}
		}
		function addTab(subtitle, url, id,iconCls) {
			var west=$("#master-layout").layout("panel",'west');
			var witdh = $(window).width()-west.width();
			if (!$("#tabs").tabs('exists', subtitle)) {
		        var allTabs = $("#tabs").tabs("tabs");
		        $("#tabs").tabs('add', {
		            title: subtitle,
		            content:'<iframe name="iframepage" id="iframepage" scrolling="yes"  frameborder="0"  src="' + url + '" style="width:'+witdh+'px;height:100%;"></iframe>',
		            closable: true,
		            id:id,
		            icon: iconCls,
		            tools: [{
		                iconCls: 'icon-refresh',
		                handler: function () {
		                    refreshTab(subtitle);//刷新当前指定tab
		                }
		            }]
		         });
		    } else {
		        $("#tabs").tabs('select', subtitle);
		        refreshTab(subtitle);
		    }
		}
		function refreshTab(title) {
		    var tt = $('#tabs');
		    tt.tabs('select', title);//跳转到指定tab
		    var cruuTab = tt.tabs('getTab', title);//获取到当前tab的title
		    var url = $(cruuTab.panel('options').content).attr('src');//获取当前tab的url
		    tt.tabs('update', {
		        tab: cruuTab,
		        options: {
		            title: title,
		            href: url // the new content URL
		        }
		    });
		}
		
		function upload_head() {
			opendialog({title:'上传头像',width:'50%',height:'70%',url:'/system/user/edit_head'})
		}
		
		
		
		  function changeTheme(type){  
			  if(type==''||type==null) {
				  type = 'insdep_theme_default.css'
			  }
			    var $easyuiTheme = $('#easyuiTheme');  
			    var theme_url = $easyuiTheme.attr('href');  
			    var href_theme = '/base/easyui/'+type;
			    $easyuiTheme.attr('href',href_theme);  
			    $.cookie('baseIIeasyuiThemeName', type, {  
			        expires : 7  
			    });  
			};  
			
			if ($.cookie('baseIIeasyuiThemeName')) {
				changeTheme($.cookie('baseIIeasyuiThemeName'));
			} else {
				changeTheme('insdep_theme_default.css');
			}
			function online() {
				var state = $("#line_state").val();
				if(state==0) {
					
					$("#online").removeClass();
					$("#online").addClass("online");
// 					$("#unread").attr("onmouseover","unread()");
					$("#line_state").val(1);
					open_socket(1)
				}else {
					$("#online").removeClass();
					$("#online").addClass("unline");
					$("#line_state").val(0);
					//onmouseover="unread()"
// 					$("#unread").attr("onmouseover","");
					open_socket(0)
				}
			}
    </script>
    
<script>(function(T,h,i,n,k,P,a,g,e){g=function(){P=h.createElement(i);a=h.getElementsByTagName(i)[0];P.src=k;P.charset="utf-8";P.async=1;a.parentNode.insertBefore(P,a)};T["ThinkPageWeatherWidgetObject"]=n;T[n]||(T[n]=function(){(T[n].q=T[n].q||[]).push(arguments)});T[n].l=+new Date();if(T.attachEvent){T.attachEvent("onload",g)}else{T.addEventListener("load",g,false)}}(window,document,"script","tpwidget","//widget.seniverse.com/widget/chameleon.js"))</script>
<script>tpwidget("init", {
    "flavor": "bubble",
    "location": "WX4FBXXFKE4F",
    "geolocation": "enabled",
    "position": "bottom-right",
    "margin": "10px 10px",
    "language": "zh-chs",
    "unit": "c",
    "theme": "black",
    "uid": "U3170DD7E2",
    "hash": "3e0fb814100bf208ed50e6d1c59eacaf"
});
tpwidget("show");</script>
</body>
</html>
